ForestToGrid Subroutine

private subroutine ForestToGrid(grid, statevar)

fill in a grid with state variable values in forest stands

Arguments

Type IntentOptional Attributes Name
type(grid_real), intent(inout) :: grid
character(len=*), intent(in) :: statevar

Variables

Type Visibility Attributes Name Initial
integer(kind=short), public :: i
integer(kind=short), public :: j
integer(kind=short), public :: k

Source Code

SUBROUTINE  ForestToGrid &
!
(grid, statevar) 
    
IMPLICIT NONE

!arguments with intent(in):
CHARACTER (LEN = *), INTENT(IN) :: statevar

!arguments with intent inout
TYPE (grid_real), INTENT (INOUT) :: grid

!local declarations
INTEGER (KIND = short) :: i, j, k


!-----------------------------end of declarations------------------------------

DO k = 1, count_stands
    i = forest (k) % i
    j = forest (k) % j 
    SELECT CASE (statevar)
        
    CASE ('lai') !leaf area index
        grid % mat (i,j) = forest (k) % first % lai
        
    CASE ('fv') !canopy cover
        grid % mat (i,j) = forest (k) % first % canopy_cover
        
    CASE ('gpp') !GPP
        grid % mat (i,j) = forest (k) % first % gpp * &
                           CellArea (grid,i,j) / hectare
        
    CASE ('npp') !NPP 
        grid % mat (i,j) = forest (k) % first % npp * &
                           CellArea (grid,i,j) / hectare
    CASE ('root') !root mass
        grid % mat (i,j) = forest (k) % first % mass_root * &
                           CellArea (grid,i,j) / hectare
        
    CASE ('stem') !stem mass
        grid % mat (i,j) = forest (k) % first % mass_stem * &
                           CellArea (grid,i,j) / hectare
        
    CASE ('leaf') !foliage mass
        grid % mat (i,j) = forest (k) % first % mass_leaf * &
                           CellArea (grid,i,j) / hectare
        
     CASE ('stemyield') !stem mass
        grid % mat (i,j) = forest (k) % first % stem_yield * &
                           CellArea (grid,i,j) / hectare
             
    CASE ('dbh') !diameter at brest heigth (cm)
        grid % mat (i,j) = forest (k) % first % dbh 
        
    CASE ('height') !tree height (m)
        grid % mat (i,j) = forest (k) % first % height
    
    CASE ('density') !tree density (trees/hectare)
        grid % mat (i,j) = forest (k) % first % density
        
   
        
    END SELECT
    
   
END DO


RETURN
END SUBROUTINE ForestToGrid